/*
 * Copyright 2011 Square Mobile www.sqrmobile.com

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package com.guidebook.source;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

// Associate with the read_qr_layout
public final class ReadQRActivity extends Activity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.read_qr_layout);

		// Declaring buttons

		final Button buttonMore = (Button) findViewById(R.id.buttonMore);

		// ---------------Testing Purpose Only------------------//
		final Button buttonTest = (Button) findViewById(R.id.buttonTesting);
		// -----------------------------------------------------//

		// Declaring text views
		final TextView textQRCode = (TextView) findViewById(R.id.textViewQRCode);

		// Declaring click events

		buttonMore.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// Execute when "More" button is clicked
				Intent readQRIntent=new Intent(v.getContext(),QRGuidebookActivity.class);
				readQRIntent.putExtra("QR_CODE", textQRCode.getText());
				startActivity(readQRIntent);
			}
		});
		
		// ---------------Testing Purpose Only------------------//
		buttonTest.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// Execute when "Testing" button is clicked

				textQRCode.setText("45652315");

			}
		});
		// -----------------------------------------------------//
	}

}
